package com.study.business.interview.controller;

import com.study.business.interview.domain.Interview;
import com.study.business.interview.service.InterviewService;
import com.study.business.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhang
 */
@RestController
@RequestMapping(value = "core")
public class InterviewController {
    @Autowired
    private InterviewService interviewService;

    @RequestMapping(value = "interview", method = RequestMethod.POST)
    public ResponseUtil addInterview(@RequestBody Interview interview) {
        return interviewService.addInterview(interview);
    }

    @RequestMapping(value = "interviews", method = RequestMethod.GET)
    public ResponseUtil getInterviews(@RequestParam("pageSize") int pageSize, @RequestParam("currentPage") int currentPage) {
        return interviewService.getInterviews(pageSize, currentPage);
    }

    @RequestMapping(value = "interview/{id:.*}", method = RequestMethod.DELETE)
    public ResponseUtil deleteInterview(@PathVariable int id) {
        return interviewService.deleteInterviews(id);
    }
}
